<template>
	<view>
		<!-- <view style="border: 1rpx solid darkgray;">
			<view style="margin: 10px;">站点 区间 施工内容 负责人</view>
		</view> -->
	<form @submit="onSubmit">
	<view style="margin: 10px; border: 1rpx solid darkgray; display: flex; align-items: center;">
	  <view style="margin: 10px;">施工申请单id</view>
	  <view style="flex: 1;"></view> <!-- 占位符，将按钮推到右边 -->
	  <view class="example-body" style="display: flex; align-items: center;">
	    <input type="text" name="formId" v-model="formData.formId" placeholder="请输入施工申请单id" />
	  </view>
	</view>
	
	<view style="margin: 10px; border: 1rpx solid darkgray; display: flex; align-items: center;">
	  <view style="margin: 10px;">令号</view>
	  <view style="flex: 1;"></view> <!-- 占位符，将按钮推到右边 -->
	  <view class="example-body" style="display: flex; align-items: center;">
	    <input type="text" name="formCode" v-model="formData.formCode" placeholder="请输入令号" />
	  </view>
	</view>
	
	<view style="margin: 10px; border: 1rpx solid darkgray; display: flex; align-items: center;">
	  <view style="margin: 10px;">要点处理人</view>
	  <view style="flex: 1;"></view> <!-- 占位符，将按钮推到右边 -->
	  <view class="example-body" style="display: flex; align-items: center;">
	    <input type="text" name="pointBy" v-model="formData.pointBy" placeholder="请输入要点处理人" />
	  </view>
	</view>
	
		
	<view style="margin: 10px; border: 1rpx solid darkgray; display: flex; align-items: center;">
	  <view style="margin: 10px;">要点照片</view>
	  <view style="flex: 1;"></view> <!-- 占位符，将按钮推到右边 -->
	  <view class="example-body" style="margin-right: 10px;display: flex; align-items: center;">
	    <uni-file-picker limit="9" file-mediatype="photo"></uni-file-picker>
	  </view>
	</view>
	
	<view style="margin: 10px; border: 1rpx solid darkgray; display: flex; align-items: center;">
	  <view style="margin: 10px;">要点时间</view>
	  <view style="flex: 1;"></view> <!-- 占位符，将按钮推到右边 -->
	  <view class="example-body" style="margin-right: 10px;display: flex; align-items: center;">
	    <view>{{date}}</view>
	  </view>
	</view>
	
	<button form-type="submit" type="primary" style="margin: 10px;">确认</button>
	</form>
	</view>
</template>

<script>
	import axios from "axios"
	import { title } from "process";
	export default {
		data() {
			return {
				date:'',
				setTime:null,
				formData: {
					    formId:'',
						formCode:'',
						pointBy:'',
						safeTechFault:'',
						safeTechHiddenDanger:'',
				        instrumentCheckList:'',
						instrumentCheckListPhoto:'',
						vehicleCheckPhoto:'',
						groundConnectionPhoto:''
				}
			}
		},
		onLoad() {
					this.setTime = setInterval( ()=> {
						let date = new Date()
						let year = date.getFullYear()
						let month = date.getMonth() + 1
						month > 9 ? month :  month='0'+month
						let day = date.getDate()
						day > 9 ? day : day = '0'+ day
						let hour = date.getHours()
						hour > 9 ? hour : hour = '0'+hour 
						let minute = date.getMinutes()
						minute > 9 ?  minute : minute = '0'+minute
						let second = date.getSeconds()
						second > 9 ? second : second = '0'+second
						this.date = year + '-'+month+'-'+day+"  "+hour+":"+minute+":"+second
					}, 1000)
				},
				onHide(){
					clearInterval(this.setTime)
				},
		methods: {
			onSubmit(e) {
			      e.preventDefault(); // 防止表单默认提交
				  console.log("test")
			      // console.log(e.target.detail.value);
			      // this.obj = e.target.detail.value;
				  axios.post("http://localhost:82/workOrderReview/management",this.formData)
				  .then((data)=>{
					  console.log(data)
					  uni.navigateTo({
					              url: '/pages/constructionprocess/constructionprocess?update1=true'
					            });
				  }).catch((err)=>{
					  console.log(err)
				  })
				  
			    },
		}
	}
</script>

<style>
	.example-body{
		  margin: 10px;
		  height: 1cm;
		  border: 1px;
		  box-sizing: border-box;
		  
	}
</style>
